import background_img from '@/assets/background_img.png'
import front_img from '@/assets/front_img.png'

import suspender_rod from '@/assets/suspender_rod.png'
import left_hook_claw from '@/assets/left_hook_claw.png'
import right_hook_claw from '@/assets/right_hook_claw.png'

export class ConfigSize {
  constructor() {
    this.bgImg = {
      width: 1920,
      height: 1080
    }
    this.clawImg = {
      width: 98,
      height: 146
    }
    this.ballImg = {
      width: 231,
      height: 279
    }
    this.ballImg = {
      width: 231,
      height: 279
    }
    this.clawRodImg = {
      width: 159,
      height: 790
    }
    this.clawOffset = {
      x: 30,
      y: 60
    }
    this.hole = {
      width: 426,
      height: 240
    }
    this.rodOffset = {
      x: 0, // 暂时没用
      y: 500 // 杆子初始化向上偏移量
    }
    this.prizeImg = {
      width: 1000,
      height: 600
    }
    this.holeAndRodOffset = 30 // 洞口和杆子偏移量,确保爪子下去在中心
    this.groundHeight = 40
    this.wallWidth = 40
    this.ballTop = 54 // 球顶部的凸起
    this.judgePointOffset = 150 // 判断点偏移到爪子中心的距离
  }
  /**
   * @description: 根据传入的长宽缩放比例修改CONFIG_SIZE
   * @param {*} xp 横向放大比
   * @param {*} yp 纵向放大比
   * @return {*}
   */
  changeConfigSize(xp = 1, yp = 1) {
    const {
      bgImg,
      clawImg,
      ballImg,
      clawRodImg,
      clawOffset,
      hole,
      rodOffset,
      holeAndRodOffset,
      groundHeight,
      wallWidth,
      ballTop,
      judgePointOffset,
      prizeImg
    } = this
    this.bgImg = {
      width: bgImg.width * xp,
      height: bgImg.height * yp
    }
    this.clawImg = {
      width: clawImg.width * xp,
      height: clawImg.height * yp
    }
    this.ballImg = {
      width: ballImg.width * xp,
      height: ballImg.height * yp
    }
    this.clawRodImg = {
      width: clawRodImg.width * xp,
      height: clawRodImg.height * yp
    }
    this.clawOffset = {
      x: clawOffset.x * xp,
      y: clawOffset.y * yp
    }
    this.hole = {
      width: hole.width * xp,
      height: hole.height * yp
    }
    this.rodOffset = {
      x: rodOffset.x * xp,
      y: rodOffset.y * yp
    }
    this.holeAndRodOffset = holeAndRodOffset * xp
    this.groundHeight = groundHeight * yp
    this.wallWidth = wallWidth * xp
    this.ballTop = ballTop * yp
    this.judgePointOffset = judgePointOffset * yp
    this.prizeImg = {
      width: prizeImg.width * xp,
      height: prizeImg.height * yp
    }
  }
}

// 娃娃机图片
export const MACHINE_TEXTURE_DATA = {
  machineBg: background_img,
  machineFront: front_img
}

// 爪子图片
export const CLAW_TEXTURE_DATA = {
  suspenderRod: suspender_rod,
  leftClaw: left_hook_claw,
  rightClaw: right_hook_claw
}
